home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / utilit~1 / stcron3.lzh / CRON.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-03  |  2.8 KB  |  132 lines

  1. /* cron.h */
  2.  
  3. #ifndef    _CRON_H
  4. #define    _CRON_H
  5.  
  6. #ifndef __MINT__
  7. #define __MINT__
  8. #endif
  9.  
  10. #include <stdio.h>
  11. #include <time.h>
  12.  
  13. /*
  14. #define DEBUG
  15. */
  16. #ifndef PROGNAME        /* should be in project- or makefile */ 
  17. #    define PROGNAME    "unknown"
  18. #endif
  19.  
  20. #define SPOOLDIR    "u:/usr/spool/cron"
  21. #define CRONDIR        SPOOLDIR "/crontabs" 
  22. #define ATDIR        SPOOLDIR "/atjobs" 
  23. #define LOGFILE        "u:/etc/syslog"
  24. #define PIDFILE        "u:/etc/crond.pid"
  25.  
  26. #define CRONPIPE    "u:/pipe/crond"
  27. #define EXTERNBUILD    50
  28. #define INTERNBUILD    51
  29.  
  30. #define USERENV        "LOGNAME"    /* "USER" for BSD */
  31.  
  32. #define SHELLCMD    "u:/bin/mintshel.ttp"
  33. #define DEFPATH        "setenv PATH u:\\bin,u:\\usr\\bin"    /* mintshel */
  34. /*
  35. #define SHELLCMD    "u:/usr/bin/tcsh.ttp"
  36. #define DEFPATH        "setenv PATH u:/bin;u:/usr/bin"        / * tcsh * /
  37. */
  38.  
  39. #define MAILCMD        "u:/bin/cat"
  40. #define MAILARG        "%s >>u:/usr/mail/%s"
  41.  
  42. #define NICELEVEL    5
  43. #define SLEEPTIME    5    /* seconds */
  44.  
  45. #define MAX_JOBS     25    /* max. number of cronjobs in tables */
  46. #define MAX_SIMJOBS      5    /* max. number of simultaneous running jobs */
  47. #define    MAX_COMMAND     90    /* max. length of job command (simple shells max. 127) */
  48. #define    MAX_FNAME    100    /* max. length for generated filename */
  49. #define    MAX_UNAME     15    /* max. length of username */
  50. #define    MAX_TEMPSTR    250    /* max. length for temp. string */
  51.  
  52. #define MAX_MIN        59
  53. #define MAX_HOUR    23
  54. #define MAX_DAYOFM    31
  55. #define MAX_MONTH    12
  56. #define MAX_DAYOFW     6
  57.  
  58. #define ULONG unsigned long
  59. #define UINT  unsigned int
  60. #define UCHAR unsigned char
  61.  
  62. typedef    struct    _entry
  63. {    ULONG    MinH,MinL;
  64.     ULONG    Hour;
  65.     ULONG    DayOfM;
  66.     UINT    Month;
  67.     UCHAR    DayOfW;
  68.     char    Command[MAX_COMMAND];
  69.     char    User[MAX_UNAME];
  70.     char     Status;
  71.     char     Type;
  72.     int        AtId;
  73. }    entry;
  74.  
  75. typedef struct _active
  76. {    int Pid;
  77.     char Output[MAX_FNAME];
  78.     char User[MAX_UNAME];
  79.     char Status;
  80. }    active;
  81.  
  82. /* values for Status and Type fields : */
  83.  
  84. #define CRON    0
  85. #define AT        1
  86.  
  87. #define SLEEP    0
  88. #define START    1    
  89.  
  90. #define FREE     0
  91. #define FINISHED 2
  92. #define BUSY     4
  93.  
  94. /* Job error status */
  95.  
  96. #define ERJOB    -1
  97. #define EROUTP    -2
  98. #define EROVFL    -3
  99.  
  100. #ifdef __MINT__
  101. #    include <mintbind.h>
  102.  
  103.     struct dirent { long d_ino; char d_name[MAX_FNAME]; } ;
  104.  
  105.     /* Dreaddir non-standard so not defined */
  106.  
  107. #    define opendir(a)    Dopendir(a,0)
  108. #    define closedir(a)    Dclosedir(a)
  109. #    define getpid()        Pgetpid()
  110. #    define getppid()    Pgetppid()
  111. #    define fork()        Pfork()
  112. #    define alarm(s)        Talarm(s)        
  113. #    define pause()        Pause()
  114. #    define setpgrp(a,b)    Psetpgrp(a,b)
  115. #    define getpgrp()    Pgetpgrp()
  116. #    define nice(a)        Pnice(a)
  117. #    define setuid(a)    Psetuid(a)
  118. #    define getuid()        Pgetuid()
  119. #    define setgid(a)    Psetgid(a)
  120.  
  121. #endif    /* __MINT__ */
  122.  
  123. #define TRUE        1
  124. #define FALSE        0
  125.  
  126. /* debugging functions */
  127.  
  128. extern void Debug(char *str, ...);
  129. extern void PrintBin(int nrbits, long value);
  130. extern void DebugPrintTimes(entry *line);
  131.  
  132. #endif